<?php

namespace Addons\OaSystem\Model;
use Think\Model;

/**
 * OaSystem模型
 */
class OaNoticeTaskReplyModel extends Model{
    public function sendSupperviseMsg ($receiver,$sender,$noticeData,$is_sendWxMsg=false) {
        $data['appid'] = get_app_info()['appid'];
        $data['noticeid'] = $noticeData['id'];
        $data['comment'] = $noticeData['details'];
        $data['time'] = $noticeData['time'];
        $data['is_read'] = 0;
        $data['receiver'] = $receiver;
        $data['sender'] = $sender;
        $data['pid'] = 0;
        $map['pid'] = 0;
        $map['noticeid'] = $noticeData['id'];
        $map['receiver'] = $receiver;
        $res = M('OaNoticeTaskReply')->where($map)->find();
        if(!empty($res)){
            $data['id'] = $res['id'];
            $id = $this->save($data);
        }else{
            $id = $this->add($data);
        }

        /*
        if ($id !== false){
            if($is_sendWxMsg === true) {
                $usr_emps = M('OaUserEmployee')->where(array('emp_id'=>$receiver))->select();
                foreach ($usr_emps as $usr_emp) {
                    if((!empty($usr_emp['openid'])) && (!empty($usr_emp['formid']))){
                    }
                }
            }
        }
        */
    }
}